package modele.gestionVente;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;

import modele.contrat.Contrat;
import modele.utilisateur.Utilisateur;


@Entity
@Inheritance(strategy= InheritanceType.JOINED)
public abstract class OffreDeVente implements Serializable {
	@Id
	@GeneratedValue
	private long idOffreDeVente;
	private int quantite;
	private Date date_emission, date_echeance;
	@ManyToOne
	private Utilisateur vendeur;
	@ManyToMany(fetch=FetchType.EAGER)
	private Set<Contrat> portefeuille;
	private boolean active;
	
	public OffreDeVente()
	{
		active = true;
	}
	
	public long getIdOffreDeVente() {
		return idOffreDeVente;
	}
	public void setIdOffreDeVente(long idOffreDeVente) {
		this.idOffreDeVente = idOffreDeVente;
	}
	public int getQuantite() {
		return quantite;
	}
	public void setQuantite(int quantite) {
		this.quantite = quantite;
	}
	public Date getDate_emission() {
		return date_emission;
	}
	public void setDate_emission(Date date_emission) {
		this.date_emission = date_emission;
	}
	public Date getDate_echeance() {
		return date_echeance;
	}
	public void setDate_echeance(Date date_echeance) {
		this.date_echeance = date_echeance;
	}
	public Utilisateur getVendeur() {
		return vendeur;
	}
	public void setVendeur(Utilisateur vendeur) {
		this.vendeur = vendeur;
	}
	public Set<Contrat> getPortefeuille() {
		return portefeuille;
	}
	public void setPortefeuille(Set<Contrat> portefeuille) {
		this.portefeuille = portefeuille;
	}

	public boolean isActive() {
		return active;
	}

	public void setActive(boolean active) {
		this.active = active;
	}
	
}
